package com.atguigu;

import org.apache.phoenix.queryserver.client.ThinClientUtil;

import java.sql.*;

public class Phoenix_JDBC_Thin {
    public static void main(String[] args) throws SQLException {
        //1.创建连接

        String url = ThinClientUtil.getConnectionUrl("hadoop102", 8765);
        System.out.println(url);
        Connection connection = DriverManager.getConnection(url);

        //2.创建语句预执行
        PreparedStatement pstm = connection.prepareStatement("select * from student");

        //3.执行语句
        ResultSet resultSet = pstm.executeQuery();

        while (resultSet.next()){
            System.out.println(resultSet.getString(1) + "-" + resultSet.getString(2) + "-" + resultSet.getString(3));
        }

        pstm.close();
        connection.close();
    }
}
